<% cache :fragment => 'celcligerais_partial_cache' do %>

	<% total_geral = 0 %>
	<% @depositos.each do |d| %>
	<% rowspan = true %>
	    <% pares_por_deposito = 0 %>
	    <table class="sortida <%= d.cor.downcase_br %>">
	        <caption><%= h d.nome.upcase_br %></caption>
	        <thead>
	        <tr>
	            <!--<th style="width:8%;" nowrap>Deposito</th>-->
	            <th  style="width:3%" nowrap>BOX</th>
				<th  style="width:8%" nowrap>Nº DT</th>			
				<th  style="width:5%" nowrap>Data</th>
	            <!--<th style="width:10%;" nowrap>Hora</th>-->
				<!-- <th  style="width:6%"nowrap>Tempo</th> -->
	            <th  style="width:7%" nowrap>TRANSP</th>
	            <th  style="width:6%" nowrap>ITIN</th>
	            <th  style="width:6%" nowrap>PARES</th>
	            <th  style="width:6%" nowrap>CXS</th>
	            <th  style="width:6%" nowrap>TIPO</th>
	            <th  style="width:6%" nowrap>VOL</th>
	            <th  style="width:6%" nowrap>PESO</th>
	            <th  style="width:10%" nowrap>STATUS</th>
	            <!--<th style="width:5%;" nowrap>Etq</th>-->
	            <th  style="width:6%" nowrap>CAR</th>
	            <th  style="width:6%" nowrap>DESTINO</th>
	            <!--<th style="width:4%;" nowrap>ETQ</th>-->
	            <th  style="width:12%" nowrap>OBS</th>
	        </tr>
	        </thead>
	        <tbody>
	        <% d.transportes.each do |wm| %>			
	            <tr class="<%= cycle("even", "odd") %>">
	                <% armazenamento = Armazenamento.deposito_transporte(d.id, wm.id)[0] %>			
	                <!--<td><%= armazenamento.deposito.nome %></td>-->
	                <td><%= armazenamento.box %></td>
					<td><%= wm.ndt %></td>
					<td><%= wm.created_at.strftime("%d/%m") %></td>
	                <!--<td><%= wm.created_at.strftime("%D/%M") %></td-->
					<!-- <td><%= distance_of_time_in_words(wm.created_at, Deposito.new.current_time,false) %></td> -->
	                <td><%= wm.transportadora.nome.upcase %></td>
	                <td><%= wm.destino.sigla.upcase %></td>
	                <td><%= armazenamento.pares.para_dinheiro.to_s_m %></td>
	                <td><%= armazenamento.cxs.para_dinheiro.to_s_m %></td>
	                <td><%= wm.tipo.sigla.upcase %></td>
	                <td><%= wm.m.para_dinheiro.to_s_m %></td>
	                <td><%= wm.peso.para_dinheiro.to_s_m %></td>                
	                <td><%= wm.status.sigla.upcase %></td>
	                <!--<td>-->
	                    <!--<%= wm.etiqueta == false ? image_tag('../../images/cross.png') : image_tag('../../images/tick.png')%>-->
	                <!--</td>-->
	                <td>
	                    <%= wm.carro == false ? image_tag('../../images/cross.png') : image_tag('../../images/tick.png')%>
	                </td>
	                <td><%= wm.itinerario %></td>
	                <% pares_por_deposito += armazenamento.pares %>
	                <!--<td><%= armazenamento.cxs.para_dinheiro.to_s_m %></td>-->
	                <!-- <td><%= wm.created_at.to_s[11..15] %></td> -->
	                <td>
						<marquee scrollamount="3" direction="left" behavior="scroll">
							<div><%= wm.obs_trans %></div>
						</marquee>
					</td>
	            </tr>
	        <% end %>
	        </tbody>
	        <tfoot>
	        <tr>
	            <td>SOMA</td>
	            <td></td>
	            <td></td>
	            <!--<td></td>-->
				<td></td>
	            <td></td>			
	            <td><%= pares_por_deposito.para_dinheiro.to_s_m %></td>
	            <% total_geral += pares_por_deposito %>
	            <td></td>
	            <td></td>
	            <td></td>
	            <td></td>
	            <!--<td></td>-->
	            <!--<td></td>-->
	            <!--<td></td>-->
	            <td></td>
	            <td></td>
	            <td></td>
	            <td></td>	
	        </tr>
	        </tfoot>
	    </table>
	<% end %>
	<div class="totalCelcli">
	    <strong>TOTAL</strong> <%= total_geral.to_i.para_dinheiro.to_s_m %>
	</div>

<% end %>